From fffdcb36d4da4e7fe9902e78ee6c15ed6114ece7 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 17 Jan 2007 16:19:09 +0000 Subject: [PATCH] Trim whitespace in unicsv read fields. Allow 'name' to float in header line. --- unicsv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unicsv.c b/unicsv.c index e6f9387e3..c71afeb36 100644 --- a/unicsv.c +++ b/unicsv.c @@ -53,7 +53,7 @@ arglist_t unicsv_args[] = { /* helpers */ -#define UNICSV_IS(f) (0 == strcmp(s, f)) +// #define UNICSV_IS(f) (0 == strcmp(s, f)) #define UNICSV_CONTAINS(f) (0 != strstr(s, f)) static void @@ -94,7 +94,7 @@ unicsv_fondle_header(char *ibuf) else if (UNICSV_CONTAINS("desc")) { unicsv_fieldpos.desccol = i; } - else if (UNICSV_IS("name")) { + else if (UNICSV_CONTAINS("name")) { unicsv_fieldpos.namecol = i; } else if (UNICSV_CONTAINS("notes")) { @@ -158,6 +158,7 @@ unicsv_parse_one_line(char *ibuf) wpt = waypt_new(); for (i=0; s; i++, s = csv_lineparse(NULL, unicsv_fieldsep, "\"", 0)) { + s = lrtrim(s); if (i == unicsv_fieldpos.latcol) { human_to_dec( s, &wpt->latitude, &wpt->longitude, 1 ); } -- 2.30.2